package com.blog.wl2023.utils;


import cn.hutool.core.util.CharsetUtil;
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
import cn.hutool.crypto.symmetric.SymmetricCrypto;

/**
 * @author wule
 * @desc 加密工具类
 */
public class MD5Util {

	/**
	 * 默认秘钥
	 **/
	private final static byte[] key = "2038195485ABCDEF".getBytes();

	//构建
	private final static SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, key);


	/**
	 * 使用aes加密
	 *
	 * @param content
	 * @return 加密为16进制表示
	 */
	public static String AESEnCode(String content) {
		String encryptHex = aes.encryptHex(content);
		return encryptHex;
	}

	/**
	 * 使用aes算法,进行解密
	 *
	 * @param ciphertext
	 * @return 解密为字符串
	 */
	public static String AESDeCode(String ciphertext) {
		String decryptStr = aes.decryptStr(ciphertext, CharsetUtil.CHARSET_UTF_8);
		return decryptStr;
	}


}
